from django.shortcuts import render,redirect
from django.http import JsonResponse,HttpResponse,request
from rest_framework.views import APIView
import hashlib,time,json,configparser
from aaa import models
from django.conf import settings
from aaa.utils import commons,response_code
from ..old_views import read_cfg

class get_dbs(APIView):
    def get(self, request, *args, **kwargs):
        dbs = read_cfg('db')
        dbs_list = []
        d = {}
        for k,v in dbs:
            d['label'] = k
            d['value'] = v
            dbs_list.append(d)
            d = {}
        return JsonResponse({'code': 1, 'data': dbs_list})